#include <iostream>
#include <algorithm>

using namespace std;


void solve(){
int n, m, l, r;
    cin >> n >> m >> l >> r;
    int k = -l; 
    int x_min = max(0, m - (n - k));
    int x_max = min(k, m);          
    int x = (x_min + x_max) / 2;    
    int y = m - x;
    cout << -x << " " << y << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
